# vim: set ft=sh ts=4 sw=4 :
export DOTDIR=~/.dotfiles
export EDITOR=nvim
export LANG=en_GB.UTF-8
export XDG_CONFIG_HOME=~/.config
export ZDOTDIR=~/.zsh
export ZIM_HOME=~/.zsh/.zim

if [ $(/usr/bin/uname -m) = "arm64" ]; then # Apple Silicon macOS
    export HOMEBREW_PREFIX="/opt/homebrew"
else # Intel macOS
    export HOMEBREW_PREFIX="/usr/local"
fi

# Color man pages
export LESS_TERMCAP_mb=$'\E[01;32m'
export LESS_TERMCAP_md=$'\E[01;32m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;47;34m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;36m'
export LESS=-r

# FZF options
export FZF_COMPLETION_TRIGGER=""
export FZF_DEFAULT_COMMAND="fd -HI -E node_modules --type f"
export FZF_CTRL_T_COMMAND="fd -H -E .git -E node_modules --type f"
export FZF_DEFAULT_OPTS="
    --bind 'ctrl-j:preview-half-page-down'
    --bind 'ctrl-k:preview-half-page-up'
    --bind 'ctrl-t:toggle-preview'
    --color 'bg+:#414559,bg:#303446,spinner:#f2d5cf,hl:#e78284'
    --color 'fg:#c6d0f5,header:#e78284,info:#ca9ee6,pointer:#f2d5cf'
    --color 'gutter:#303446'
    --color 'marker:#f2d5cf,fg+:#c6d0f5,prompt:#ca9ee6,hl+:#e78284'
    --height 80%
    --highlight-line
    --info 'inline-right'
    --input-border 'rounded'
    --list-border 'rounded'
    --margin 0
    --no-scrollbar
    --padding 0
    --pointer ''
    --preview 'bat --color=always --style=changes,snip,numbers {}'
    --preview-window 'right:50%,wrap,hidden,<50(down)'
    --prompt ' '
"

# Forgit
export FORGIT_FZF_DEFAULT_OPTS="--reverse --border-label-pos=5 --preview-window='nohidden'"
export FORGIT_ADD_FZF_OPTS="$FORGIT_FZF_DEFAULT_OPTS --input-label='Git Add'"
export FORGIT_DIFF_FZF_OPTS="$FORGIT_FZF_DEFAULT_OPTS --input-label='Git Diff'"
export FORGIT_DIFF_GIT_OPTS="--patience"
export FORGIT_LOG_FORMAT="%C(yellow)[%h]%Creset  %s"
export FORGIT_LOG_FZF_OPTS="$FORGIT_FZF_DEFAULT_OPTS --input-label='Git Log'"
export FORGIT_LOG_GRAPH_ENABLE="false"
export FORGIT_NO_ALIASES=true
export FORGIT_PAGER='delta --config ~/.gitconfig --file-style omit'

# Prompt config
export STARSHIP_CONFIG=~/.starship.toml

# Make sure Homebrew libs are in the path
export PATH="$HOMEBREW_PREFIX/bin:$PATH"
